package org.codefinger.json.parser.deserializer;

import org.codefinger.json.parser.JSONArrayDeserializer;
import org.codefinger.json.parser.JSONDeserializer;
import org.codefinger.json.parser.JSONLexer;
import org.codefinger.json.parser.JSONObjectDeserializer;

public class DeserializerForDoubleArray implements JSONDeserializer {

	public static final DeserializerForDoubleArray	INSTANCE	= new DeserializerForDoubleArray();

	private DeserializerForDoubleArray() {

	}

	
	@Override
	public Object stringValue(String value) {
		return  new double[] { Double.parseDouble(value) };
	}

	
	@Override
	public Object stringValue(JSONLexer jsonLexer) {
		return  new double[] { Double.parseDouble(jsonLexer.getOriginalString()) };
	}

	
	@Override
	public Object intValue(String value) {
		return  new double[] { Double.parseDouble(value) };
	}

	
	@Override
	public Object floatValue(String value) {
		return  new double[] { Double.parseDouble(value) };
	}

	
	@Override
	public Object falseValue() {
		return  new double[] { 0 };
	}

	
	@Override
	public Object trueValue() {
		return  new double[] { 1 };
	}

	@Override
	public JSONArrayDeserializer createArrayDeserializer() {
		return new ArrayDeserializerForDoubleArray();
	}

	@Override
	public JSONObjectDeserializer createObjectDeserializer() {
		return ObjectDeserializerForNull.INSTANCE;
	}

}
